cmake_minimum_required(VERSION 2.8.3)
project(px4_swarm_control)

## Compile as C++11, supported in ROS Kinetic and newer
add_definitions(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    mavros
    roslib
    std_msgs
    message_generation
    message_filters
    serial
    message_runtime
)

find_package(lcm REQUIRED)
add_message_files(
        FILES
        remote_uwb_info.msg
        incoming_broadcast_data.msg
        data_buffer.msg
        Swarm_Position.msg
        drone_task_status.msg
        sp_target_position.msg
)

generate_messages(
        DEPENDENCIES
        std_msgs
        geometry_msgs
)
catkin_package(
    CATKIN_DEPENDS roscpp rospy std_msgs 
)

include_directories(
    include
    ${catkin_INCLUDE_DIRS}
)

add_executable(uwb_ros_node
  src/Communicate/uwb_node_server.cpp
  src/Communicate/UWBRosNode.cpp
  include/MsgLink/UWBManager.cpp
)

add_dependencies(uwb_ros_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(uwb_ros_node ${catkin_LIBRARIES} )

add_executable(test_uwb_ros_node
        src/test/test_uwb_ros_node.cpp
        src/Communicate/UWBRosNode.cpp
        include/MsgLink/UWBManager.cpp
        )

add_dependencies(test_uwb_ros_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(test_uwb_ros_node ${catkin_LIBRARIES} )


add_executable(test_offboard_manager src/test/test_offboard_manager.cpp src/OffboardManager/OffboardManager.cpp src/OffboardManager/OffboardManager.h )
add_dependencies(test_offboard_manager ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(test_offboard_manager ${catkin_LIBRARIES} )

add_executable(lcm_ros_node src/Communicate/LcmRosNode.cpp )
add_dependencies(lcm_ros_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(lcm_ros_node ${catkin_LIBRARIES} lcm)

add_executable(swarm_core src/SwarmCore/SwarmCore.cpp src/OffboardManager/OffboardManager.cpp)
add_dependencies(swarm_core ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(swarm_core ${catkin_LIBRARIES} lcm)

